import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    redirect: '/home',  // 重定向:重新指向其它path,会改变网址
  }
  ,
  
  {
    path:"/home",
    component:()=>import('../page/Home.vue'),
    meta:{
      label:'二级视图'
    },
    children:[
      {
        path:'/class',
        component:()=>import('../page/Class.vue'),
        meta:{
          label:'班级'
        },
      },
      {
        path:'/students',
        component:()=>import('../page/Students.vue'),
        meta:{
          label:'学生'
        },
      },

    ]
  },
  {
    path:"/login",
    component:()=>import('../page/Login.vue'),
    meta:{
      label:'登录'
    },
  },
  {
    path:"/registry",
    component:()=>import('../page/Registry.vue'),
    meta:{
      label:'注册'
    },
  },

  // {
  //   path: '/',
  //   name: 'home',
  //   component: HomeView
  // },
  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
